// *** ADDED BY HEADER FIXUP ***
#include <wx/colour.h>
#include <wx/msgdlg.h>
#include <wx/utils.h>
// *** END ***
#include "NewQueryDlg.h"

//(*InternalHeaders(NewQueryDlg)
#include <wx/font.h>
#include <wx/intl.h>
#include <wx/string.h>
//*)
//(*IdInit(NewQueryDlg)
const long NewQueryDlg::ID_STATICTEXT1 = wxNewId();
const long NewQueryDlg::ID_STATICTEXT2 = wxNewId();
const long NewQueryDlg::ID_STATICTEXT3 = wxNewId();
const long NewQueryDlg::ID_TEXTCTRL1 = wxNewId();
const long NewQueryDlg::ID_STATICTEXT4 = wxNewId();
const long NewQueryDlg::ID_TEXTCTRL2 = wxNewId();
const long NewQueryDlg::ID_STATICTEXT5 = wxNewId();
const long NewQueryDlg::ID_BUTTON1 = wxNewId();
const long NewQueryDlg::ID_BUTTON2 = wxNewId();
//*)

BEGIN_EVENT_TABLE(NewQueryDlg,wxDialog)
	//(*EventTable(NewQueryDlg)
	//*)
END_EVENT_TABLE()

NewQueryDlg::NewQueryDlg(wxWindow* parent)
{
	BuildContent(parent);
}

void NewQueryDlg::BuildContent(wxWindow* parent,wxWindowID id)
{
	//(*Initialize(NewQueryDlg)
	wxBoxSizer* BoxSizer4;
	wxBoxSizer* BoxSizer2;
	wxBoxSizer* BoxSizer1;
	wxBoxSizer* BoxSizer3;

	Create(parent, id, _("新建咨询类型"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id"));
	SetClientSize(wxDefaultSize);
	Move(wxDefaultPosition);
	BoxSizer1 = new wxBoxSizer(wxVERTICAL);
	BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
	StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("咨询问题："), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
	StaticText1->SetForegroundColour(wxColour(255,0,0));
	wxFont StaticText1Font(12,wxSWISS,wxFONTSTYLE_NORMAL,wxBOLD,false,_T("Arial"),wxFONTENCODING_DEFAULT);
	StaticText1->SetFont(StaticText1Font);
	BoxSizer2->Add(StaticText1, 0, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	lbQuery = new wxStaticText(this, ID_STATICTEXT2, _("Label"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	lbQuery->SetForegroundColour(wxColour(0,128,192));
	wxFont lbQueryFont(10,wxSWISS,wxFONTSTYLE_NORMAL,wxBOLD,false,wxEmptyString,wxFONTENCODING_DEFAULT);
	lbQuery->SetFont(lbQueryFont);
	BoxSizer2->Add(lbQuery, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	BoxSizer1->Add(BoxSizer2, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
	StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("新建的咨询类型："), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
	BoxSizer3->Add(StaticText3, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	txQueryType = new wxTextCtrl(this, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxSize(153,22), 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	BoxSizer3->Add(txQueryType, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("请为问题添加一个回答："), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
	BoxSizer3->Add(StaticText4, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	txAnswer = new wxTextCtrl(this, ID_TEXTCTRL2, _("Text"), wxDefaultPosition, wxSize(141,22), 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
	BoxSizer3->Add(txAnswer, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	BoxSizer1->Add(BoxSizer3, 1, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	BoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
	StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("PS.请认真审慎地填写添加，不要重复创建已有的咨询类型。确定后将提交到服务器。"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5"));
	StaticText5->SetForegroundColour(wxColour(255,0,0));
	BoxSizer4->Add(StaticText5, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	bnEnter = new wxButton(this, ID_BUTTON1, _("确定"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	BoxSizer4->Add(bnEnter, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	bnCancle = new wxButton(this, ID_BUTTON2, _("取消"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
	BoxSizer4->Add(bnCancle, 1, wxALL|wxALIGN_LEFT|wxALIGN_BOTTOM, 5);
	BoxSizer1->Add(BoxSizer4, 1, wxALL|wxALIGN_RIGHT|wxALIGN_BOTTOM, 5);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);

	Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&NewQueryDlg::OnbnEnterClick);
	Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&NewQueryDlg::OnbnCancleClick);
	//*)
}

NewQueryDlg::~NewQueryDlg()
{
	//(*Destroy(NewQueryDlg)
	//*)
}
int NewQueryDlg::ShowModal(const wxString& query)
{
    lbQuery->SetLabel(query);
    txQueryType->Clear();
    txAnswer->Clear();
    return wxDialog::ShowModal();
}


void NewQueryDlg::OnbnEnterClick(wxCommandEvent& event)
{
    if(!txQueryType->IsEmpty()&&!txAnswer->IsEmpty()) EndModal(wxID_OK);
    else
    {
        wxMessageBox(wxT("咨询类型和回答都不能为空！"));
    }
}

void NewQueryDlg::OnbnCancleClick(wxCommandEvent& event)
{
    EndModal(wxID_CANCEL);
}

wxString NewQueryDlg::GetQueryType()
{
    return txQueryType->GetValue();
}

wxString NewQueryDlg::GetAnswer()
{
    return txAnswer->GetValue();
}
